package cn.openea.perpartner.common.core.enums;

/**
 * @author Weird077
 * @description TODO
 * @date 2023-05-25 14:01
 */
public enum RabbitEnums {
    COMPONET_BUSINESS("component.business.routing.key","sms.delayed.exchange", "component.business.queue"),
    COMPONET_SMS("sms.business.routing.key","sms.delayed.exchange", "sms.business.queue"),
    MEILY_BUSINESS("meily.business.routing.key","meily.delayed.exchange", "meily.business.queue"),
    MEILY_DELAY("meily.delayed.routing.key","meily.delayed.exchange", "meily.delayed.queue");
    private final String routingKey;
    private final String exchange;
    private final String queueName;
    public String getRoutingKey() {
        return routingKey;
    }
    public String getExchange() {
        return exchange;
    }
    public String getQueueName() {
        return queueName;
    }
    RabbitEnums(String routingKey, String exchange, String queueName) {
        this.routingKey = routingKey;
        this.exchange = exchange;
        this.queueName = queueName;
    }
    public static RabbitEnums getRabbitInfo(String routingKey) {
        for (RabbitEnums rabbit: RabbitEnums.values()) {
            if (rabbit.routingKey.equals(routingKey)) {
                return rabbit;
            }
        }
        return RabbitEnums.COMPONET_BUSINESS;
    }
}
